home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / units / graphics.tst < prev    next >
Text File  |  1994-04-04  |  4KB  |  134 lines

  1. USES Graphics,OGWare;
  2.  
  3. CONST fg=yellow;
  4.       bg=lightblue;
  5.       hl=lightcyan;
  6.       sd=blue;
  7.  
  8. VAR stop,next,prev,redp,redm,grep,grem,blup,blum,grap,gram,blck,graa,save,
  9.     load:BUTTON; a,r,g,b,n:BYTE; name:TextFrame; dac:DACBUFFER;
  10.  
  11. PROCEDURE TegnRgb;
  12.  VAR s:STRING;
  13.  BEGIN
  14.    n:=n MOD 16; DacGetSingle(FourBitDac[n],r,g,b); Fbox(235, 50,330,117,n);
  15.    s:=Null(n,3);             WriteLine(60,50,s,White,Black);
  16.    s:=Null(FourBitDac[n],3); WriteLine(60,60,s,White,Black);
  17.    s:=Null(r,3);             WriteLine(60,70,s,White,Black);
  18.    s:=Null(g,3);             WriteLine(60,80,s,White,Black);
  19.    s:=Null(b,3);             WriteLine(60,90,s,White,Black);
  20.  END;
  21.  
  22. BEGIN
  23.   IF NOT GraphicsMode(Ega640x350x016) THEN
  24.    BEGIN WriteLn('Could not initiate the right mode.'); Halt(1); END;
  25.   IF NOT MouseInitiateInterrupt THEN
  26.    BEGIN WriteLn('Could not initiate the Mouse/Interrupt.'); Halt(1); END;
  27.  
  28.   Box(0,0,482,42,White); FOR a:=0 TO 15 DO Fbox(2+a*30,2,30+a*30,40,a);
  29.   Box(0,45,90,101,White); Box(230, 45,335,122,White);
  30.   WriteLine(5,50,'Color:',Yellow,Black);
  31.   WriteLine(5,60,'DAC  :',Yellow,Black);
  32.   WriteLine(5,70,'Red  :',Yellow,Black);
  33.   WriteLine(5,80,'Green:',Yellow,Black);
  34.   WriteLine(5,90,'Blue :',Yellow,Black);
  35.  
  36.   n:=0; TegnRgb; Mouse(ON);
  37.  
  38.   stop.Init(  5,329, 50,345,fg,bg,hl,sd,'Exit'); stop.Draw;
  39.   load.Init( 55,329,100,345,fg,bg,hl,sd,'Load'); load.Draw;
  40.   save.Init(105,329,150,345,fg,bg,hl,sd,'Save'); save.Draw;
  41.   name.Init(155,330,LightCyan,LightBlue,Yellow,Blue,12,' Filename: ','default.dac');
  42.   name.Draw;
  43.  
  44.   prev.Init(  0,108, 45,123,fg,bg,hl,sd,'Prev'); prev.Draw;
  45.   next.Init( 46,108, 90,123,fg,bg,hl,sd,'Next'); next.Draw;
  46.  
  47.   redm.Init(100, 44,160, 59,fg,bg,hl,sd,'red-'); redm.Draw;
  48.   redp.Init(165, 44,225, 59,fg,bg,hl,sd,'red+'); redp.Draw;
  49.   grem.Init(100, 60,160, 75,fg,bg,hl,sd,'green-'); grem.Draw;
  50.   grep.Init(165, 60,225, 75,fg,bg,hl,sd,'green+'); grep.Draw;
  51.   blum.Init(100, 76,160, 91,fg,bg,hl,sd,'blue-'); blum.Draw;
  52.   blup.Init(165, 76,225, 91,fg,bg,hl,sd,'blue+'); blup.Draw;
  53.   gram.Init(100, 92,160,107,fg,bg,hl,sd,'grey-'); gram.Draw;
  54.   grap.Init(165, 92,225,107,fg,bg,hl,sd,'grey+'); grap.Draw;
  55.   blck.Init(100,108,160,123,fg,bg,hl,sd,'Black'); blck.Draw;
  56.   graa.Init(165,108,225,123,fg,bg,hl,sd,'Gray'); graa.Draw;
  57.  
  58.   REPEAT
  59.     IF next.Quick(160) THEN
  60.      BEGIN
  61.        Inc(n); TegnRgb;
  62.      END;
  63.     IF prev.Quick(160) THEN
  64.      BEGIN
  65.        Dec(n); TegnRgb;
  66.      END;
  67.     IF redp.Quick( 30) THEN
  68.      BEGIN
  69.        Inc(r); DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  70.      END;
  71.     IF redm.Quick( 30) THEN
  72.      BEGIN
  73.        Dec(r); DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  74.      END;
  75.     IF grep.Quick( 30) THEN
  76.      BEGIN
  77.        Inc(g); DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  78.      END;
  79.     IF grem.Quick( 30) THEN
  80.      BEGIN
  81.        Dec(g); DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  82.      END;
  83.     IF blup.Quick( 30) THEN
  84.      BEGIN
  85.        Inc(b); DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  86.      END;
  87.     IF blum.Quick( 30) THEN
  88.      BEGIN
  89.        Dec(b); DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  90.      END;
  91.     IF grap.Quick( 30) THEN
  92.      BEGIN
  93.        Inc(r); Inc(g); Inc(b);
  94.        DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  95.      END;
  96.     IF gram.Quick( 30) THEN
  97.      BEGIN
  98.        Dec(r); Dec(g); Dec(b);
  99.        DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  100.      END;
  101.     IF (MouseButtons=Left) AND (MouseYpos<42) AND (MouseXpos<482) THEN
  102.      BEGIN
  103.        n:=(MouseXpos DIV 30) MOD 16; TegnRgb;
  104.      END;
  105.     IF Blck.Pressed THEN
  106.      BEGIN
  107.        r:=0; g:=0; b:=0; DacSetSingle(FourBitDac[n],r,g,b); TegnRgb;
  108.      END;
  109.     IF Graa.Pressed THEN
  110.      BEGIN
  111.        a:=r; IF a<g THEN a:=g; IF a<b THEN a:=b;
  112.        a:=(a+r+b+g) DIV 4; r:=a; g:=a; b:=a;
  113.        DacSetSingle(FourBitDac[n],r,g,b);
  114.        TegnRgb;
  115.      END;
  116.     IF Load.Pressed THEN
  117.      BEGIN
  118.        IF FileExists(name.data)
  119.         THEN
  120.          BEGIN
  121.            DacLoadPalette(name.data,dac); DacSetPalette(dac);
  122.          END
  123.         ELSE Beep(2000,50);
  124.      END;
  125.     IF Save.Pressed THEN
  126.      BEGIN
  127.        DacGetPalette(dac); DacSavePalette(name.data,dac);
  128.      END;
  129.     Name.Inside;
  130.   UNTIL stop.Pressed;
  131.  
  132.   MouseEndInterrupt; GraphicsMode(Txt080xOwnFont);
  133.  
  134. END.